package com.ruoyi.location.repository.generator.mapper;

import com.ruoyi.location.repository.generator.entity.LocationTeam;
import com.ruoyi.location.repository.generator.entity.LocationTeamExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface LocationTeamMapper {
    @SelectProvider(type=LocationTeamSqlProvider.class, method="countByExample")
    long countByExample(LocationTeamExample example);

    @DeleteProvider(type=LocationTeamSqlProvider.class, method="deleteByExample")
    int deleteByExample(LocationTeamExample example);

    @Delete({
        "delete from location_team",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into location_team (name, owner_id, ",
        "valid, ctime, ",
        "utime)",
        "values (#{name,jdbcType=VARCHAR}, #{ownerId,jdbcType=BIGINT}, ",
        "#{valid,jdbcType=INTEGER}, #{ctime,jdbcType=TIMESTAMP}, ",
        "#{utime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(LocationTeam row);

    @InsertProvider(type=LocationTeamSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(LocationTeam row);

    @SelectProvider(type=LocationTeamSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="owner_id", property="ownerId", jdbcType=JdbcType.BIGINT),
        @Result(column="valid", property="valid", jdbcType=JdbcType.INTEGER),
        @Result(column="ctime", property="ctime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="utime", property="utime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<LocationTeam> selectByExample(LocationTeamExample example);

    @Select({
        "select",
        "id, name, owner_id, valid, ctime, utime",
        "from location_team",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="owner_id", property="ownerId", jdbcType=JdbcType.BIGINT),
        @Result(column="valid", property="valid", jdbcType=JdbcType.INTEGER),
        @Result(column="ctime", property="ctime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="utime", property="utime", jdbcType=JdbcType.TIMESTAMP)
    })
    LocationTeam selectByPrimaryKey(Long id);

    @UpdateProvider(type=LocationTeamSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("row") LocationTeam row, @Param("example") LocationTeamExample example);

    @UpdateProvider(type=LocationTeamSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("row") LocationTeam row, @Param("example") LocationTeamExample example);

    @UpdateProvider(type=LocationTeamSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(LocationTeam row);

    @Update({
        "update location_team",
        "set name = #{name,jdbcType=VARCHAR},",
          "owner_id = #{ownerId,jdbcType=BIGINT},",
          "valid = #{valid,jdbcType=INTEGER},",
          "ctime = #{ctime,jdbcType=TIMESTAMP},",
          "utime = #{utime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(LocationTeam row);
}